'This part is for the script specific error log (instead of popup messages).
'The advantage of an error log instead of a popup is that the script
'continues running even after an error appears. An example of an error would
'be a timeout due to a temporarily slow web site.
Dim objFileSystem, objOutputFile
Dim strOutputFile
Const OPEN_FILE_FOR_APPENDING = 8
' generate a logfile name based on the script name
strOutputFile = "./combine-macros-errorlog.txt"
Set objFileSystem = CreateObject("Scripting.fileSystemObject")
Set objOutputFile = objFileSystem.CreateTextFile(strOutputFile, TRUE)
objOutputFile.WriteLine("Error Log for COMBINE-MACROS.VBS demo script")
'****
Msgbox ("This example script calls several Internet macros. Each macro performs a specific function on the website (Loading the website with wsh-start, form filling with wsh-lunch and finally submitting the form with wsh-submit)." + vbCrLf + vbCrLf + "The script also demonstrates how to create a SCRIPT SPECIFIC error log file.")
set iim1= CreateObject ("iimwsh.iim")
i= iim1.iimInit
'If i < 0 Then msgbox iim1.iimGetLastMessage()
if i < 0 then objOutputFile.WriteLine("INIT: Error-No: " + cstr(i) + " => Description: " + iim1.iimGetLastMessage())
i = iim1.iimPlay("wsh-start")
'If i < 0 Then msgbox iim1.iimGetLastMessage()
if i < 0 then objOutputFile.WriteLine("WSH-START: Error-No: " + cstr(i) + " => Description: " + iim1.iimGetLastMessage())
i = iim1.iimPlay("wsh-lunch")
'If i < 0 Then msgbox iim1.iimGetLastMessage()
if i < 0 then objOutputFile.WriteLine("WSH-LUNCH: Error-No: " + cstr(i) + " => Description: " + iim1.iimGetLastMessage())
i = iim1.iimPlay("wsh-submit")
'If i < 0 Then msgbox iim1.iimGetLastMessage()
if i < 0 then objOutputFile.WriteLine("WSH-SUBMIT: Error-No: " + cstr(i) + " => Description: " + iim1.iimGetLastMessage())
i = iim1.iimExit
if i < 0 then objOutputFile.WriteLine("EXIT: Error-No: " + cstr(i) + " => Description: " + iim1.iimGetLastMessage())
'*****
'This part is for the script specific error log (instead of popup messages).